package com.fmx.BookStore.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fmx.BookStore.core.domain.BaseEntity;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class Permission extends BaseEntity {
    //权限ID
    private Long permissionId;
    //权限名
    private String permissionName;
    //父ID
    private Long pid;
    //优先级
    @TableField(exist = true)
    private Long sortNum;
    @TableField(exist = true)
    //路径
    private String path;
    //子菜单
    @TableField(exist = false)
    private List<Permission> children;

    public Permission() {
    }

    public Permission(Long permissionId, String permissionName, Long pid, Long sortNum, String path, List<Permission> children) {
        this.permissionId = permissionId;
        this.permissionName = permissionName;
        this.pid = pid;
        this.sortNum = sortNum;
        this.path = path;
        this.children = children;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public List<Permission> getChildren() {
        return children;
    }

    public void setChildren(List<Permission> children) {
        this.children = children;
    }


    public Long getSortNum() {
        return sortNum;
    }

    public void setSortNum(Long sortNum) {
        this.sortNum = sortNum;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }


    public Long getPermissionId() {
        return permissionId;
    }

    public void setPermissionId(Long permissionId) {
        this.permissionId = permissionId;
    }

    public String getPermissionName() {
        return permissionName;
    }

    public void setPermissionName(String permissionName) {
        this.permissionName = permissionName;
    }

    @Override
    public String toString() {
        return "Permission{" +
                "permissionId=" + permissionId +
                ", permissionName='" + permissionName + '\'' +
                ", pid=" + pid +
                ", sortNum=" + sortNum +
                ", path='" + path + '\'' +
                ", children=" + children +
                '}';
    }
}
